package com.colorfruit;

import com.colorfruit.framework.model.BaseRole;
import com.colorfruit.framework.model.vo.RespCode;
import com.colorfruit.framework.model.vo.RespVo;
import com.colorfruit.service.BaseRoleRemoteService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * Created by xiehf on 2018/4/17.
 */
@FeignClient(name = InterfaceService.SERVICE_NAME, fallback = BaseRoleService.HystrixClientFallback.class)
public interface BaseRoleService extends BaseRoleRemoteService {

    class HystrixClientFallback implements BaseRoleService{

        @Override
        public RespVo<List<BaseRole>> getRoleByUserId(@PathVariable("userId") String userId) {
            return RespVo.error(RespCode.ERROR.getCode(),RespCode.ERROR.getMessage());
        }
    }
}
